package com.fxu.gen.enums;

import com.fxu.framework.core.enums.BaseEnum;
import lombok.AllArgsConstructor;

/**
 * 搜索类型
 * @author fangxu
 * @version 1.0.0
 */
@AllArgsConstructor
public enum QueryType implements BaseEnum {
    EQUALS(1, "="),
    LIKE(2, "like"),
    RIGHT_LIKE(3, "right like"),
    RANGE_NOT_EQUALS(4, "> and <"),
    RANGE_EQUALS(5, ">= and <="),
    ;

    int code;
    String desc;

    @Override
    public Integer code() {
        return code;
    }
    @Override
    public String desc() {
        return desc;
    }

    public static QueryType find(Integer code) {
        return code == null ? null : BaseEnum.findOne(QueryType.values(), v -> code.equals(v.code));
    }
}